package other;

import java.net.URL;

import javafx.application.Application;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

// 设置光标
public class CursorDemo extends Application {
	private StackPane root = new StackPane();
	private Button button;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		URL url = getClass().getClassLoader().getResource("image/3.jpg");   // 设置图片为光标
		root.setCursor(Cursor.cursor(url.toExternalForm()) );
		
		button = new Button("click me");
		button.setCursor(Cursor.WAIT);      // 设置等待光标(还有手状，文本，移动等光标)
//		button.setStyle("-fx-cursor: wait");
		root.getChildren().add(button);
		
		Scene scene = new Scene(root, 300, 250);
		stage.setScene(scene);   
		stage.show();
	}
}
